package com.hh.controller;

import hh.edu.service.IUserService;
import hh.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("user")
public class UserController {

    @Autowired
    private IUserService iUserService;


    @RequestMapping(value = "login.do")
    public String login(){
        System.out.println("login");
        return "Default";
    }

    @RequestMapping("manage")
    public String manage(){
        return "User/UserManage";
    }

    @RequestMapping("info")
    public String info(){
        return "User/UserInfo";
    }

    @RequestMapping(value = "findById.do")
    public String findById(Integer id, Model model){

        User user = iUserService.findById(id);
        model.addAttribute("user",user);
        return "index";
    }

    @RequestMapping("edit")
    public String edit(){
        return "User/UserEdit";
    }
}
